<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>kuikui</title><meta name="author" content="Kuikui Hu"><meta name="copyright" content="Kuikui Hu"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta property="og:type" content="website">
<meta property="og:title" content="kuikui">
<meta property="og:url" content="https://kuikui1998.gitee.io/page/2/index.html">
<meta property="og:site_name" content="kuikui">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://kuikui1998.gitee.io/img/me.jpg">
<meta property="article:author" content="Kuikui Hu">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://kuikui1998.gitee.io/img/me.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://kuikui1998.gitee.io/page/2/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  ClickShowText: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2021-01-05 17:40:20'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'false'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}})()</script><meta name="generator" content="Hexo 5.2.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="/img/me.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">23</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div></div></div><hr/></div></div><div id="body-wrap"><header class="full_page" id="page-header" style="background-image: url(/img/backgroud.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">kuikui</a></span><span id="menus"><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="site-info"><h1 id="site-title">kuikui</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/kuikui1998" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="/shakuil@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/18/Java%E5%8F%8D%E5%B0%84%E6%9C%BA%E5%88%B6/" title="Java高级学习之-反射">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-反射"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/18/Java%E5%8F%8D%E5%B0%84%E6%9C%BA%E5%88%B6/" title="Java高级学习之-反射">Java高级学习之-反射</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-18T01:15:56.000Z" title="发表于 2020-06-18 09:15:56">2020-06-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java反射机制一、反射的概述1.本章的主要内容
2.关于反射的理解Reflection（反射)是被视为动态语言的关键，反射机制允许程序在执行期借助于Reflection API取得任何类的内部信息，并能直接操作任意对象的内部属性及方法。
框架 = 反射 + 注解 + 设计模式。
3.体会反射机制的“动态性”12345678910111213141516171819202122232425262728293031323334353637383940//体会反射的动态性@Testpublic void test2()&#123;    for(int i = 0;i &lt; 100;i++)&#123;        int num = new Random().nextInt(3);//0,1,2        String classPath = &quot;&quot;;        switch(num)&#123;            case 0:                classPath = &quot;java.util.Date&quot;;        ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/06/16/Java%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" title="Java高级学习之-网络编程">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-网络编程"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/16/Java%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" title="Java高级学习之-网络编程">Java高级学习之-网络编程</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-16T01:15:56.000Z" title="发表于 2020-06-16 09:15:56">2020-06-16</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java网络编程一、InetAddress类的使用一、实现网络通信需要解决的两个问题 1.如何准确地定位网络上一台或多台主机；定位主机上的特定的应用 2.找到主机后如何可靠高效地进行数据传输
二、网络通信的两个要素： 1.对应问题一：IP和端口号 2.对应问题二：提供网络通信协议：TCP/IP参考模型（应用层、传输层、网络层、物理+数据链路层）
三、通信要素一：IP和端口号1.IP的理解

IP:唯一的标识 Internet 上的计算机（通信实体）

在Java中使用InetAddress类代表IP

IP分类：IPv4 和 IPv6 ; 万维网 和 局域网

域名:   www.baidu.com   www.mi.com  www.sina.com  www.jd.com
 域名解析：域名容易记忆，当在连接网络时输入一个主机的域名后，域名服务器(DNS)负责将域名转化成IP地址，这样才能和主机建立连接。 ——-==域名解析==

本地回路地址：127.0.0.1 对应着：localhost


2.InetAddress类:此类的一个对象就代表着一个具体的IP地址2.1实例化get ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/11/JavaIO%E6%B5%81/" title="Java高级学习之-IO流">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-IO流"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/11/JavaIO%E6%B5%81/" title="Java高级学习之-IO流">Java高级学习之-IO流</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-11T01:15:56.000Z" title="发表于 2020-06-11 09:15:56">2020-06-11</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">JavaIO流一、File类的使用1.File类的理解
File类的一个对象，代表一个文件或一个文件目录(俗称：文件夹)
File类声明在java.io包下
File类中涉及到关于文件或文件目录的创建、删除、重命名、修改时间、文件大小等方法，并未涉及到写入或读取文件内容的操作。如果需要读取或写入文件内容，必须使用IO流来完成。
后续File类的对象常会作为参数传递到流的构造器中，指明读取或写入的”终点”.

2.File的实例化2.1 常用构造器File(String filePath)File(String parentPath,String childPath)File(File parentFile,String childPath)
2.2 路径的分类相对路径：相较于某个路径下，指明的路径。绝对路径：包含盘符在内的文件或文件目录的路径
说明：IDEA中：如果大家开发使用JUnit中的单元测试方法测试，相对路径即为当前Module下。如果大家使用main()测试，相对路径即为当前的Project下。Eclipse中：不管使用单元测试方法还是使用main()测试，相对路径都是当前的 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/06/06/Java%E6%B3%9B%E5%9E%8B/" title="Java高级学习之-泛型">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-泛型"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/06/Java%E6%B3%9B%E5%9E%8B/" title="Java高级学习之-泛型">Java高级学习之-泛型</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-06T01:15:56.000Z" title="发表于 2020-06-06 09:15:56">2020-06-06</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java泛型一、泛型的理解1.泛型的概念所谓泛型，就是允许在定义类、接口时通过一个标识表示类中某个属性的类型或者是某个方法的返回值及参数类型。这个类型参数将在使用时（例如，继承或实现这个接口，用这个类型声明变量、创建对象时确定（即传入实际的类型参数，也称为类型实参）。
2.泛型的引入背景集合容器类在设计阶段/声明阶段不能确定这个容器到底实际存的是什么类型的对象，所以在JDK1.5之前只能把元素类型设计为Object，JDK1.5之后使用泛型来解决。因为这个时候除了元素的类型不确定，其他的部分是确定的，例如关于这个元素如何保存，如何管理等是确定的，因此此时==把元素的类型设计成一个参数，这个类型参数叫做泛型==。Collection，List，ArrayList   这个就是类型参数，即泛型。
二、泛型在集合中的使用1.在集合中使用泛型之前的例子1234567891011121314151617181920@Test    public void test1()&#123;        ArrayList list = new ArrayList();        //需求：存放学生 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/05/Java%E9%9B%86%E5%90%88/" title="Java高级学习之-Java集合">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-Java集合"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/05/Java%E9%9B%86%E5%90%88/" title="Java高级学习之-Java集合">Java高级学习之-Java集合</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-05T01:15:56.000Z" title="发表于 2020-06-05 09:15:56">2020-06-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java集合##一、数组与集合
1.集合与数组存储数据概述：集合、数组都是对多个数据进行存储操作的结构，简称Java容器。说明：此时的存储，主要指的是内存层面的存储，不涉及到持久化的存储（.txt,.jpg,.avi，数据库中)
2.数组存储的特点：
一旦初始化以后，其长度就确定了。
数组一旦定义好，其元素的类型也就确定了。我们也就只能操作指定类型的数据了。
 比如：String[] arr;int[] arr1;Object[] arr2;

3.数组存储的弊端：
一旦初始化以后，其长度就不可修改。
数组中提供的方法非常限，对于添加、删除、插入数据等操作，非常不便，同时效率不高。
获取数组中实际元素的个数的需求，数组没有现成的属性或方法可用
数组存储数据的特点：有序、可重复。对于无序、不可重复的需求，不能满足。

4.集合存储的优点：解决数组存储数据方面的弊端。
二、Collection接口1.单列集合框架结构|—-Collection接口：单列集合，用来存储一个一个的对象          |—-List接口：存储序的、可重复的数据。  –&gt;“动态”数组            ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/06/02/Java%E6%9E%9A%E4%B8%BE%E7%B1%BB%E5%92%8C%E6%B3%A8%E8%A7%A3/" title="Java高级学习之-枚举类和注解">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-枚举类和注解"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/02/Java%E6%9E%9A%E4%B8%BE%E7%B1%BB%E5%92%8C%E6%B3%A8%E8%A7%A3/" title="Java高级学习之-枚举类和注解">Java高级学习之-枚举类和注解</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-02T01:11:56.000Z" title="发表于 2020-06-02 09:11:56">2020-06-02</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">枚举类和注解一、枚举类的使用1.枚举类的说明：1.枚举类的理解：类的对象只有有限个，确定的。我们称此类为枚举类2.当需要定义一组常量时，强烈建议使用枚举类3.如果枚举类中只一个对象，则可以作为单例模式的实现方式。
###2.如何自定义枚举类？步骤：
1234567891011121314151617181920212223242526272829303132333435//自定义枚举类class Season&#123;    //1.声明Season对象的属性:private final修饰    private final String seasonName;    private final String seasonDesc;    //2.私化类的构造器,并给对象属性赋值    private Season(String seasonName,String seasonDesc)&#123;        this.seasonName = seasonName;        this.seasonDesc = seasonDesc;    &#125;    //3.提供 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/01/Java%E5%B8%B8%E7%94%A8%E7%B1%BB/" title="Java高级学习之-常用类">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-常用类"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/01/Java%E5%B8%B8%E7%94%A8%E7%B1%BB/" title="Java高级学习之-常用类">Java高级学习之-常用类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-01T01:15:56.000Z" title="发表于 2020-06-01 09:15:56">2020-06-01</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java常用类一、String类java.lang.String类的使用
1.概述String:字符串，使用一对””引起来表示。1.String声明为final的，不可被继承2.String实现了Serializable接口：表示字符串是支持序列化的。        实现了Comparable接口：表示String可以比较大小3.String内部定义了final char[] value用于存储字符串数据4.通过字面量的方式（区别于new给一个字符串赋值，此时的字符串值声明在字符串常量池中)。5.字符串常量池中是不会存储相同内容(使用String类的equals()比较，返回true)的字符串的。
2.String的不可变性2.1 说明1.当对字符串重新赋值时，需要重写指定内存区域赋值，不能使用原有的value进行赋值。2.当对现的字符串进行连接操作时，也需要重新指定内存区域赋值，不能使用原有的value进行赋值。3.当调用String的replace()方法修改指定字符或字符串时，也需要重新指定内存区域赋值，不能使用原有的value进行赋值。2.2 代码举例
123456789101 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/31/Java%E5%A4%9A%E7%BA%BF%E7%A8%8B/" title="Java高级学习之-多线程">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java高级学习之-多线程"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/31/Java%E5%A4%9A%E7%BA%BF%E7%A8%8B/" title="Java高级学习之-多线程">Java高级学习之-多线程</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-31T01:11:56.000Z" title="发表于 2020-05-31 09:11:56">2020-05-31</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E9%AB%98%E7%BA%A7/">Java高级</a></span></div><div class="content">Java多线程一、程序、进程、线程的理解###1.程序(programm)概念：是为完成特定任务、用某种语言编写的一组指令的集合。即指一段静态的代码。
###2.进程(process)概念：程序的一次执行过程，或是正在运行的一个程序。说明：进程作为资源分配的单位，系统在运行时会为每个进程分配不同的内存区域
###3.线程(thread)概念：进程可进一步细化为线程，是一个程序内部的一条执行路径。说明：线程作为调度和执行的单位，每个线程拥独立的运行栈和程序计数器(pc)，线程切换的开销小。

补充：内存结构：

进程可以细化为多个线程。每个线程，拥有自己独立的：栈、程序计数器多个线程，共享同一个进程中的结构：方法区、堆。
二、并行与并发
单核CPU与多核CPU的理解


单核CPU，其实是一种假的多线程，因为在一个时间单元内，也只能执行一个线程的任务。例如：虽然有多车道，但是收费站只有一个工作人员在收费，只有收了费才能通过，那么CPU就好比收费人员。如果某个人不想交钱，那么收费人员可以把他“挂起”（晾着他，等他想通了，准备好了钱，再去收费。）但是因为CPU时间单元特别短，因此感觉不出来。 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/27/Java%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1(%E4%B8%8B)/" title="Java基础学习之-面向对象(下)">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java基础学习之-面向对象(下)"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/27/Java%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1(%E4%B8%8B)/" title="Java基础学习之-面向对象(下)">Java基础学习之-面向对象(下)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-27T01:11:56.000Z" title="发表于 2020-05-27 09:11:56">2020-05-27</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E5%9F%BA%E7%A1%80/">Java基础</a></span></div><div class="content">面向对象(下)一、关键字：staticstatic:静态的
1.可以用来修饰的结构：主要用来修饰类的内部结构属性、方法、代码块、内部类
2.static修饰属性：静态变量（或类变量）2.1 属性，是否使用static修饰，又分为：静态属性  vs 非静态属性(实例变量)实例变量：我们创建了类的多个对象，每个对象都独立的拥一套类中的非静态属性。当修改其中一个对象中的非静态属性时，不会导致其他对象中同样的属性值的修改。静态变量：我们创建了类的多个对象，多个对象共享同一个静态变量。当通过某一个对象修改静态变量时，会导致其他对象调用此静态变量时，是修改过了的。2.2 static修饰属性的其他说明：① 静态变量随着类的加载而加载。可以通过”类.静态变量”的方式进行调用② 静态变量的加载要早于对象的创建。③ 由于类只会加载一次，则静态变量在内存中也只会存在一份：存在方法区的静态域中。④                类变量    实例变量        类        yes        no        对象        yes        yes
2.3 静态属性举例：System ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/26/Java%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1(%E4%B8%AD)/" title="Java基础学习之-面向对象(中)">     <img class="post_bg" src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JavaSE/java.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java基础学习之-面向对象(中)"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/26/Java%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1(%E4%B8%AD)/" title="Java基础学习之-面向对象(中)">Java基础学习之-面向对象(中)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-26T01:11:56.000Z" title="发表于 2020-05-26 09:11:56">2020-05-26</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link">•</span><a class="article-meta__tags" href="/tags/Java%E5%9F%BA%E7%A1%80/">Java基础</a></span></div><div class="content">面向对象(中）##一、面向对象的特征二：继承性
1.为什么要有类的继承性？(继承性的好处）① 减少了代码的冗余，提高了代码的复用性② 便于功能的扩展③ 为之后多态性的使用，提供了前提图示：

2.继承性的格式：class A extends B{}  A:子类、派生类、subclass  B:父类、超类、基类、superclass
3.子类继承父类以后有哪些不同？3.1体现：一旦子类A继承父类B以后，子类A中就获取了父类B中声明的==所有的属性和方法==。特别的，父类中声明为private的属性或方法，子类继承父类以后，仍然认为获取了父类中私的结构。只因为封装性的影响，使得子类不能直接调用父类的结构而已。3.2 子类继承父类以后，还可以声明自己特有的属性或方法：实现功能的拓展。extends：延展、扩展
4.Java中继承性的说明1.一个类可以被多个子类继承。2.Java中类的单继承性：一个类只能有一个父类3.子父类是相对的概念。4.子类直接继承的父类，称为：直接父类。间接继承的父类称为：间接父类5.子类继承父类以后，就获取了直接父类以及所间接父类中声明的属性和方法
图示：

5.ja ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="page-number current">2</span><a class="page-number" href="/page/3/">3</a><a class="extend next" rel="next" href="/page/3/"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" src="/img/me.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">Kuikui Hu</div><div class="author-info__description"></div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">23</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/kuikui1998"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/kuikui1998" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="/shakuil@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">Welcome Kuikui's Blog</div></div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/01/05/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC4%E7%AB%A0-%E8%99%9A%E6%8B%9F%E6%9C%BA%E6%A0%88/" title="JVM系列-第4章-虚拟机栈"><img src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JVM/jvm.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JVM系列-第4章-虚拟机栈"/></a><div class="content"><a class="title" href="/2021/01/05/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC4%E7%AB%A0-%E8%99%9A%E6%8B%9F%E6%9C%BA%E6%A0%88/" title="JVM系列-第4章-虚拟机栈">JVM系列-第4章-虚拟机栈</a><time datetime="2021-01-05T07:31:58.000Z" title="发表于 2021-01-05 15:31:58">2021-01-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC3%E7%AB%A0-%E8%BF%90%E8%A1%8C%E6%97%B6%E6%95%B0%E6%8D%AE%E5%8C%BA/" title="JVM系列-第3章-运行时数据区"><img src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JVM/jvm.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JVM系列-第3章-运行时数据区"/></a><div class="content"><a class="title" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC3%E7%AB%A0-%E8%BF%90%E8%A1%8C%E6%97%B6%E6%95%B0%E6%8D%AE%E5%8C%BA/" title="JVM系列-第3章-运行时数据区">JVM系列-第3章-运行时数据区</a><time datetime="2020-12-11T07:31:58.000Z" title="发表于 2020-12-11 15:31:58">2020-12-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC2%E7%AB%A0-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%AD%90%E7%B3%BB%E7%BB%9F/" title="JVM系列-第2章-类加载子系统"><img src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JVM/jvm.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JVM系列-第2章-类加载子系统"/></a><div class="content"><a class="title" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC2%E7%AB%A0-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%AD%90%E7%B3%BB%E7%BB%9F/" title="JVM系列-第2章-类加载子系统">JVM系列-第2章-类加载子系统</a><time datetime="2020-12-11T06:31:58.000Z" title="发表于 2020-12-11 14:31:58">2020-12-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC1%E7%AB%A0-JVM%E4%B8%8EJava%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/" title="JVM系列-第1章-JVM与Java体系结构"><img src="https://gitee.com/kuikui1998/images_ben/raw/master/images/java/JVM/jvm.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JVM系列-第1章-JVM与Java体系结构"/></a><div class="content"><a class="title" href="/2020/12/11/JVM%E7%B3%BB%E5%88%97-%E7%AC%AC1%E7%AB%A0-JVM%E4%B8%8EJava%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/" title="JVM系列-第1章-JVM与Java体系结构">JVM系列-第1章-JVM与Java体系结构</a><time datetime="2020-12-11T00:51:56.000Z" title="发表于 2020-12-11 08:51:56">2020-12-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/12/09/docker%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/" title="docker常用命令"><img src="https://gitee.com/kuikui1998/images_ben/raw/master/images/tools/docker.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="docker常用命令"/></a><div class="content"><a class="title" href="/2020/12/09/docker%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/" title="docker常用命令">docker常用命令</a><time datetime="2020-12-09T09:25:56.000Z" title="发表于 2020-12-09 17:25:56">2020-12-09</time></div></div></div></div></div><div class="card-widget card-categories"><div class="card-content"><div class="item-headline"><i class="fas fa-folder-open"></i><span>分类</span></div><ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/JVM/"><span class="card-category-list-name">JVM</span><span class="card-category-list-count">4</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">15</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%AE%9E%E7%94%A8%E5%B7%A5%E5%85%B7/"><span class="card-category-list-name">实用工具</span><span class="card-category-list-count">4</span></a></li>
            
            </ul></div></div><div class="card-widget card-tags"><div class="card-content"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/JDBC/" style="font-size: 1.1em; color: #999">JDBC</a> <a href="/tags/JVM/" style="font-size: 1.2em; color: #999da3">JVM</a> <a href="/tags/Java/" style="font-size: 1.5em; color: #99a9bf">Java</a> <a href="/tags/Java%E5%9F%BA%E7%A1%80/" style="font-size: 1.3em; color: #99a1ac">Java基础</a> <a href="/tags/Java%E9%AB%98%E7%BA%A7/" style="font-size: 1.4em; color: #99a5b6">Java高级</a> <a href="/tags/docker/" style="font-size: 1.1em; color: #999">docker</a> <a href="/tags/git/" style="font-size: 1.1em; color: #999">git</a> <a href="/tags/hexo/" style="font-size: 1.1em; color: #999">hexo</a> <a href="/tags/javeweb/" style="font-size: 1.1em; color: #999">javeweb</a> <a href="/tags/linux/" style="font-size: 1.1em; color: #999">linux</a> <a href="/tags/%E8%99%9A%E6%8B%9F%E6%9C%BA/" style="font-size: 1.2em; color: #999da3">虚拟机</a></div></div></div><div class="card-widget card-archives"><div class="card-content"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/01/"><span class="card-archive-list-date">一月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/12/"><span class="card-archive-list-date">十二月 2020</span><span class="card-archive-list-count">7</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/07/"><span class="card-archive-list-date">七月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/06/"><span class="card-archive-list-date">六月 2020</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/05/"><span class="card-archive-list-date">五月 2020</span><span class="card-archive-list-count">6</span></a></li></ul></div></div><div class="card-widget card-webinfo"><div class="card-content"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">23</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2021-01-05T09:40:19.483Z"></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Kuikui Hu</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> {preloader.endLoading()})</script><div class="js-pjax"><script>function subtitleType () {
  $.getJSON('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',function (data) {
    if (true) {
      var sub = "".length == 0 ? new Array() : "".split(',')
      var both = sub.unshift(data.text)
      typed = new Typed('#subtitle', {
        strings: sub,
        startDelay: 300,
        typeSpeed: 150,
        loop: true,
        backSpeed: 50,
      })
    } else {
      document.getElementById('subtitle').innerHTML = data.text
    }
  })
}

if (true) {
  if (typeof Typed === 'function') subtitleType()
  else $.getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js', subtitleType)
} else {
  subtitleType()
}
</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="true"></script></div></body></html>